From a4104914ea6f004b6a8d3d8701b0e43727fe3bd5 Mon Sep 17 00:00:00 2001 From: Klaus Purer Date: Sat, 31 Mar 2018 11:19:28 +0200 Subject: [PATCH] tests(help): Add test for -Z help output --- src/bin/cli.rs | 11 +++++------ tests/testsuite/cargo_command.rs | 12 ++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/bin/cli.rs b/src/bin/cli.rs index ed5c4805d..f1440053d 100644 --- a/src/bin/cli.rs +++ b/src/bin/cli.rs @@ -16,12 +16,11 @@ pub fn main(config: &mut Config) -> CliResult { " Available unstable (nightly-only) flags: - -Z avoid-dev-deps -- Avoid installing dev-dependencies if possible - -Z minimal-versions -- Install minimal dependency versions instead of maximum - -Z no-index-update -- Do not update the registry, avoids a network request for benchmarking - -Z offline -- Offline mode that does not perform network requests - -Z print-im-a-teapot -- Example option for demonstration purposes - -Z unstable-options -- Allow the usage of unstable options such as --registry + -Z avoid-dev-deps -- Avoid installing dev-dependencies if possible + -Z minimal-versions -- Install minimal dependency versions instead of maximum + -Z no-index-update -- Do not update the registry, avoids a network request for benchmarking + -Z offline -- Offline mode that does not perform network requests + -Z unstable-options -- Allow the usage of unstable options such as --registry Run with 'cargo -Z [FLAG] [SUBCOMMAND]'" ); diff --git a/tests/testsuite/cargo_command.rs b/tests/testsuite/cargo_command.rs index f3ceeca63..eecf74a84 100644 --- a/tests/testsuite/cargo_command.rs +++ b/tests/testsuite/cargo_command.rs @@ -331,3 +331,15 @@ fn explain() { ), ); } + +// Test that the output of 'cargo -Z help' shows a different help screen with +// all the -Z flags. +#[test] +fn z_flags_help() { + assert_that( + cargo_process().arg("-Z").arg("help"), + execs() + .with_status(0) + .with_stdout_contains("-Z unstable-options"), + ); +} -- 2.30.2